<template>
    <div class="apply-container">
        <div class="left">{{ apply.systemname }}</div>

        <div class="center">
            <img :src="apply.avatar" alt="" />
            <div class="user">
                <p>{{ apply.nickname }}</p>
                <p>ID:{{ apply.uid }}</p>
            </div>
        </div>

        <div class="right">
            <p class="success" v-if="apply.status == 1">绑定成功</p>
            <p class="failure" v-if="apply.status == 2">已拒绝</p>

            <div class="btn" v-if="apply.status == 0" @click.stop="emitConfirm">确认绑定</div>
            <div class="btn" v-if="apply.status == 0" @click.stop="emitRefuse">拒绝绑定</div>
        </div>

        <Confirm title="系统绑定成功" :isAlert="true" ref="confirm"></Confirm>
    </div>
</template>

<script>
import Confirm from '@/components/common/confirm';

export default {
    name: 'apply-card',
    data() {
        return {};
    },
    props: {
        apply: {
            type: Object,
            isRequired: true
        }
    },
    computed: {},
    created() {},
    mounted() {},
    methods: {
        emitConfirm() {
            this.$emit('confirm', this.apply,true);
        },
        emitRefuse() {
            this.$emit('refuse', this.apply,false);
        }
    },
    watch: {},
    components: {Confirm}
};
</script>

<style lang="stylus" scoped>
@import '~assets/main.styl'

*{
    box-sizing border-box!important
}

.apply-container {
    position: relative
    width: 100vw
    height vw(80)
    padding vw(17) cellPadding
    margin-bottom vw(5)
    background grayF
    flex-x(space-between,flex-start)
    .left {
        height vw(46)
        flex 0 0 vw(100)
        margin-right vw(8)
        word-vw(word14,gray3)
        line-height vw(46)

    }
    .center {
        height vw(46)
        margin-right vw(8)
        flex-x(space-between,center)
        img{
            width vw(40)
            height vw(40)
            margin-right smallMargin
            border-radius all-radius
        }
        .user{
            height vw(40)
            flex-y(space-between,flex-start)
            word-vw(word14,gray3)
            line-height vw(19)
        }
    }

    .right {
        height vw(46)
        flex 1 0 auto
        flex-y(space-between,flex-end)
        .btn{
            small-hollow()
            width vw(60)
            height vw(18)!important
            line-height vw(18)!important
            background-color grayF!important
            word-vw(word10,#000)
        }
        .success{
            word-vw(word12,main-color)
            line-height vw(46)
        }
        .failure{
            word-vw(word12,gray9)
            line-height vw(46)
        }
    }
}
</style>
